import request from '@/utils/request'

// 获取用户列表
export const getUserList = (params: any) => {
    return request('/api/users', 'get', params)
}

export const addUser = (params: any) => {
    return request('/api/users', 'post', params)
}


// 注册
export const register = (data: any) => {
    return request('/api/users/register', 'post', data)
}

// 编辑用户
export const editUser = (id: number, data: any) => {
    return request(`/api/users/${id}`, 'put', data)
}

// 删除用户
export const deleteUser = (id: number) => {
    return request(`/api/users/${id}`, 'delete')
}

// 更新用户状态
export const updateUserStatus = (id: number, status: number) => {
    return request(`/api/users/${id}/status`, 'put', { status })
}

// 更新用户角色
export const updateUserRole = (id: number, role: number[]) => {
    return request(`/api/users/${id}/role`, 'put', { role })
}

